package com.rescue.mapper;

import com.rescue.forum.entity.ForumArticleAttachmentDownload;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ArticleAttachmentDownloadMapper {
    @Update("update forum_article_attachment_download set download_count = download_count + #{downloadCount} where user_id = #{userId} and file_id = #{fileId}")
    void update(ForumArticleAttachmentDownload record);

    @Insert("insert into forum_article_attachment_download (file_id, user_id, article_id, download_count) value (#{fileId}, #{userId}, #{articleId}, #{downloadCount})")
    void save(ForumArticleAttachmentDownload.ForumArticleAttachmentDownloadBuilder downloadCount);
}
